#ifndef QMAPS_H
#define QMAPS_H

#include <QWidget>
#include <QWebView>
#include <QWebFrame>
#include <QPointer>
#include <QModelIndex>

class QAbstractItemModel;
class QModelIndex;

class Maps : public QWidget
{
    Q_OBJECT
    
public:
    Maps(QWidget *parent = 0);

    QAbstractItemModel* model() const;
    void setModel(QAbstractItemModel* model);

public slots:
    void goHome();
    void addMarker(double x, double y, const QString& txt);
public slots:
    void currentChanged(const QModelIndex & current, const QModelIndex & previous);
    void dataChanged   (const QModelIndex & topLeft, const QModelIndex & bottomRight,
                        const QVector<int>& roles);
private slots:
    void onMapLoaded(bool ok);
private:
    void updateCurrent();
private:
    void setupUI();

    QWebView *mView;
    QPointer<QAbstractItemModel>  model_;
    QModelIndex                   current_;

    QString current_link_;
    QString current_name_;
};

#endif // QMAPS_H
